<template>
    <div class="orh-trees1">
        <div class="orh-trees-tree">
            <div class="cont_heads" v-if="treesHead">
                <h4 style="font-size:14px;font-weight:700;color:#222">{{treesHead.title}}</h4>
            </div>
            <div class="tresscon">
                <slot name="trees"></slot>
            </div>
        </div>
        <div class="orh-trees-body">
            <div class="orh-trees-body-heads">
                <div class="right_handels"></div>
                <div class="right_handels">
                    <Input v-model="value" icon="search" placeholder="请输入搜索内容" style="width: 200px;" class="icon_handel" size="small" @on-click="toSearch" @on-enter="toSearch" v-if="search">
                        <Select v-model="before" slot="prepend" style="width: 70px" v-if="searchOption">
                            <Option  v-for="(item,index) in searchOption" :key="index" :value="item.value">{{item.label}}</Option>
                        </Select>
                    </Input>
                    <Tooltip content="刷新" placement="bottom" class="icon_handel" v-if="reload">
                        <span @click="toReload"><Icon type="loop" size="22"></Icon></span>
                    </Tooltip>
                </div>
            </div>
            <div class="orh-trees-body-content" :style="{top: '40px'}">
                <slot name="content"></slot>
            </div>
        </div>
        <slot name="others"></slot>
    </div>
</template>

<script>
    export default {
        data() {
            return {
                value:'',
                before: this.searchOptionSelected != undefined ? this.searchOptionSelected:null,
             
            }
        },
        props: {
            
            'reload': Boolean,
            'search': {
                type: Boolean,
                default: false
            },
            'treesHead': Object,
            'searchOptionSelected': String,
            'searchOption': Array
        },
        methods: {
            toReload() {
                this.value=''
                this.$emit('on-reload');
            },
            toSearch() {
                this.$emit('on-search',this.value,this.before);
            },
        },
        created() { }
    }
</script>

<style lang="less">
.orh-trees1 {
    width: 100%;
    height: 100%;
    position: relative;
    .orh-trees-tree {
        position: absolute;
        left: 0;
        top: 0px;
        bottom: 0;
        // width: 200px;
        width: 123px;
        border-top: 1px solid #e9eaec;
        border-right: 1px solid #e9eaec;
        border-left: 1px solid #e9eaec;
        overflow: auto;
        .cont_heads {
            display: flex;
            justify-content: space-between;
            align-items: center;
            height: 40px;
            padding: 0 15px;
            border-bottom: 1px solid #e9eaec;
            .right_handels {
                width: auto;
                display: flex;
                justify-content: flex-end;
            }
        }
        .tresscon {
            padding: 15px 17px;
        }
    }
    .orh-trees-body {
        position: absolute;
        left: 123px;
        top: 0px;
        right: 0;
        bottom: 0;
        border-right: 1px solid #e9eaec;
        .orh-trees-body-heads {
            display: flex;
            justify-content: space-between;
            align-items: center;
            height: 40px;
            padding: 0 15px;
            border-top: 1px solid #e9eaec;
            border-bottom: 1px solid #e9eaec;
            .right_handels {
                width: auto;
                display: flex;
                justify-content: flex-end;
            }
        }
        .orh-trees-body-content {
            position: absolute;
            bottom: 0; left: 0; right:0;
            overflow: hidden;
        }
        .icon_handel {
            cursor: pointer;
            margin-right: 20px;
        }
    }
}
</style>
